/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller.dao;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author Adriano Essa classe retorna a conexão
 */
public class Connection {

	private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("Agenda");
    //Método estatico que retorna o EntityManager Para todos os DAO.
    public static EntityManager getConnection() {       
        return emf.createEntityManager();     
    }
    
    public static void limpaCache(){
    	emf.getCache().evictAll();
    }
}
